<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆-信息')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-edit" th:object="${carInfo}">
            <input name="carInfoId" th:field="*{carInfoId}" type="hidden">
            <input name="carId" th:field="*{carId}" type="hidden">
            <input name="menuId" th:field="*{menuId}" type="hidden">
            <input name="configType" th:field="*{configType}" type="hidden">
            <input id="car_info" name="info" th:field="*{info}" type="hidden">

            <div class="row clearfix">
                <div class="col-sm-2 column">
                    预览图片
                    <ul class="list-group" id="left_img_list"></ul>
                </div>
                <div class="col-sm-10 column">
                    <div class="row clearfix">
                        <div class="col-md-12 column">
                            <th:block class="form-group" th:if="${carInfo.carInfoId!=null}">
                                <label class="col-sm-1 control-label">图片</label>
                                <div class="col-sm-11" th:include="system/common/file_select :: multiple_img(_file_id='multipleFile',_img_list_id='left_img_list',_file_list=${@file.getFiles(carInfo.carId,carInfo.configType)})"/>
                            </th:block>
                        </div>
                    </div>

                    <div class="row clearfix" style='vertical-align: middle;text-align: center'>
                        <div class="form-group">
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-1')">整车细节1</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-2')">整车细节2</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-3')">整车细节3</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-4')">整车细节4</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-5')">整车细节5</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-6')">整车细节6</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-7')">整车细节7</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-8')">整车细节8</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-9')">整车细节9</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-10')">整车细节10</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-11')">整车细节11</span></h1></div>
                            <div class="col-sm-2 column"><h1><span class="car_item label" th:onclick="multipleFile_manager.initImgList(this,[[${carInfo.carId}]],[[${carInfo.configType}]],'vehicle-details-12')">整车细节12</span></h1></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注：</label>
                        <div class="col-sm-8"><textarea name="remark" class="form-control">[[*{remark}]]</textarea></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-8"><button type="button" class="btn btn-success" onclick="submitHandler()">上传</button></div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/car/info";
        $("#form-info-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                let json=$('#form-info-edit').serializeJson();
                console.log(json)
                $('#car_info').val(JSON.stringify(json.infoMap)||'{}');
                let serialize = $('#form-info-edit').serialize();
                console.log(serialize)
                // console.log(JSON.stringify($('#form-info-edit').serializeJson()))
                // return;
                $.operate.save(prefix + "/edit?_="+Math.random(), serialize);
            }
        }
        $(function (){
            multipleFile_manager.init({busId: [[${carInfo.carId}]], busType: [[${carInfo.configType}]], fileType: 'img'});
        });
    </script>
</body>
</html>